#include <iostream>
#include <set>
#include <functional>

using namespace std;

namespace  My {
    template <class Arg1, class Arg2, class Result>
    struct binary_function {
        typedef Arg1 first_argument_type;
        typedef Arg2 second_argument_type;
        typedef Result result_type;
    };

    template <class T>
    struct less : public binary_function<T, T, bool > {
        bool operator() (const T& x, const T& y)   { return x < y;}
    };
}


int main()
{
    //GCC
    _Rb_tree <int, int, _Identity<int>, less<int> > itree;
    cout << "itree.empty(): \t " <<itree.empty() << endl;
    cout << "itree.size(): \t " << itree.size() << endl;

    for (int i = 0; i < 10; ++i) {
        itree._M_insert_unique(std::move(i));
    }

    itree._M_insert_equal(5);

    cout << "itree.empty(): \t " <<itree.empty() << endl;
    cout << "itree.size():\t " << itree.size() << endl;
    cout << "itree.count():\t " << itree.count(5) << endl;


    auto fun = My::less<int>();
    cout << ( fun(5, 6) ? "5 < 6" : "5 > 6") << endl;

    int aa = 6;
    int bb = 7;
    My::less<int> f();

    cout << typeid(f).name() << endl;
    cout << typeid(f).hash_code() << endl;

    cout << typeid(fun).name() << endl;
    cout << typeid(fun).hash_code() << endl;

    return 0;
}


